package com.item.service.impl;

import com.github.pagehelper.PageHelper;
import com.item.domain.CommentPay;
import com.item.mapper.CommentPayMapper;
import com.item.service.CommentPayService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class CommentPayServiceImpl implements CommentPayService {

    @Autowired
    CommentPayMapper commentPayMapper;

    @Override
    public List<CommentPay> findAll(int limit, int page, CommentPay commentPay) {
        if (limit > 0 && page > 0) {
            PageHelper.startPage(limit, page);
        }
        return commentPayMapper.findAll(commentPay);
    }

    @Override
    public int add(CommentPay commentPay) {
        return commentPayMapper.insertSelective(commentPay);
    }

    @Override
    public int update(CommentPay commentPay) {
        return commentPayMapper.updateByPrimaryKeySelective(commentPay);
    }

    @Override
    public int delete(int id) {
        return commentPayMapper.deleteByPrimaryKey(id);
    }
}
